package com.draem0507.refactor;

/**
 * @title 使用委托来代替继承
 * @desc
 * @atuh lwx
 * @createtime on 2015/11/13 12:58
 */
public class Day_8 {


    class Sanitation1 {
        public String WashHands() {
            return "Cleaned!";
        }
    }

    class Child1 {
        private Sanitation1 Sanitation;

        public Child1() {
            Sanitation = new Sanitation1();
        }

        public String WashHands() {
            return Sanitation.WashHands();
        }
    }


    class Sanitation {
        public String WashHands() {
            return "Cleaned!";
        }
    }

    public class Child extends Sanitation {
    }
}
